<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: red;
            margin-top: 5px;
        }
    </style>
    <script src="./../jquery-1.12.4.js"></script>
</head>

<body>
    <div></div>
    <div>我是div2</div>
    <div>我是div3</div>
    <div><span></span></div>
    <div>
        <p></p>
    </div>
    <script>
        var $div1 = $('div:empty');
        var $div2 = $('div:parent');
        var $div3 = $('div:contains("我是div")');
        var $div4 = $('div:has("span")');
    </script>
</body>

</html>